<html>
<head>
	<meta charset="utf-8">
	<title>喵~~</title>
	<link rel="stylesheet" type="text/css" href="../../style_nobg.css">
</head>
<body>
	<script>
		function getqueryvar(variable) {
			var query = window.location.search.substring(1);
			var vars = query.split("&");
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split("=");
				if (pair[0] == variable) { return pair[1]; }
			}
			return false;
		} // Copy from https://www.runoob.com/w3cnote/js-get-url-param.html
		function modifyarg(variable, value) {
			url = window.location.href;
			first = url.indexOf(variable + '=') + variable.length + 1;
			last = url.substring(first).indexOf('&');
			// console.log(last);
			if (last < 0) return url.slice(0, first) + value;
			else return url.slice(0, first) + value + url.slice(first + last);

		}
		// console.log(getqueryvar("msg"));
		// console.log(modifyarg("msg", "20"));
	</script>
	<script src="data.js"></script>
	<script>
		function morehist() {
			window.location.href = modifyarg("msg", (parseInt(getqueryvar("msg")) + 10).toString());
		}
		if (Number(getqueryvar("msg")) + 10 <= getmsgnum()) {
			document.body.innerHTML += "<a href=\"javascript:void(0);\" onclick=\"morehist();\">查看更多消息</a>";
		}
		msgs = getmsg(Number(getqueryvar("msg")));
		for (var loop = 0; loop < msgs.length; loop++) {
			// document.write("<br />" + msgs[loop]);
			document.body.innerHTML += "<p>" + msgs[loop] + "</p>";
		}
	</script>
</body>
</html>
